package com.example.d8_interface2;


import com.example.d5_abstract2.Animal;
import com.example.d5_abstract2.Cat;

/**
 * 目标：搞清楚使用接口的好处
 */
public class Test {
    public static void main(String[] args) {
        Driver s = new A();
        s.drive();

        // 面向接口编程
        Driver d = new A();
        Driver d1 = new B();
        d.drive();

        Animal a = new Cat();
        a.cry();
    }
}

class B implements Driver {
    @Override
    public void drive() {

    }
}

// 好处：弥补单继承的不足
class A extends Student implements Driver, Singer {
    @Override
    public void drive() {

    }

    @Override
    public void sing() {

    }
}

class Student {

}

interface Driver {
    void drive();
}

interface Singer {
    void sing();
}